import { defineStore } from 'pinia';
// import { IUserPlaylist } from '@/models/userPlaylist';
// import { getLikelist, getUserPlaylist, likeSong } from '@/api/api';
import { ElMessage } from 'element-plus';
import { Login } from '@/api';

export const useUserStore = defineStore('user', {
	state: () => {
		return {
			adminId: 0,
			songLikes: [],
			//token: '',
			adminName:'',
			adminavatar:'',
			cookie: '',
			isLogin: false,
		};
	},
	getters: {
		// isLogin: (state: any) => {
		// 	return state.profile?.userId > 0;
		// },
	},
	actions: {
        async Login(userData:any) {
            const res = await Login(userData);
            if(res){
                this.isLogin = true;
                // this.adminId = res.id;
				// this.adminName = res.name;
				//this.useravatar = res.avatar;
				return true;
            }else{
                ElMessage.error('密码错误');
				return false;
            }
         },


	},
    //persist: true
});
